package com.spirng.leetcode.day06;

import java.util.List;

public class Test404 {
    public int sumOfLeftLeaves(TreeNode root) {
        return sumOfLeft(root);
    }
    public int sumOfLeft(TreeNode node){
        if(node==null){
            return 0;
        }
        int leftValue=sumOfLeft(node.left);
        if (node.left!=null&& node.left.left==null&&node.left.right==null){
            leftValue=node.left.val;
        }
        int rightValue=sumOfLeft(node.right);
        int sum=leftValue+rightValue;
        return sum;
    }
}
